package com.cookman.screens;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;
import com.cookman.actions.Action;
import com.cookman.controllers.GameAlice;
import com.cookman.renderers.WorldRenderer;
import com.cookman.serviceLocators.ServiceLocator;
import com.cookman.world.entities.Player;

import java.util.List;

/**
 * Created by Cookman on 14.04.14.
 */
public class GameScreen extends AbstractGameScreen {

    private boolean paused;

    public GameScreen(GameAlice game) {
        super(game);
    }

    @Override
    public void render(float deltaTime) {
// Do not update game world when paused.
        if (!paused) {
// Update game world by the time that has passed
// since last rendered frame.
        }
// Sets the clear screen color to: Cornflower Blue
        Gdx.gl.glClearColor(1f, 1f, 1f, 1);
// Clears the screen
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
// Render game world to screen
        ServiceLocator.getWorldRenderer().render(deltaTime);
    }

    @Override
    public void resize(int width, int height) {
        ServiceLocator.getWorldRenderer().resize(width, height);
    }

    @Override
    public void show() {
        ServiceLocator.setWorldRenderer(new WorldRenderer());
    }

    @Override
    public void hide() {
        ServiceLocator.getWorldRenderer().dispose();
        Gdx.input.setCatchBackKey(false);
    }

    @Override
    public void pause() {
        paused = true;
    }

    @Override
    public void resume() {
        super.resume();
// Only called on Android!
        paused = false;
    }
}



